github-actions[bot] 的 git 权限被拒绝

github-actions[bot] 的 git 权限被拒绝

cccs7 Lv5

我在使用 GitHub actions 实现同步博客文章到github首页时出现以下报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Run ad-m/github-push-action@v0.6.0
Started: bash /home/runner/work/_actions/ad-m/github-push-action/v0.6.0/start.sh
Push to branch master
remote: Permission to cs7eric/cs7eric.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cs7eric/cs7eric.git/': The requested URL returned error: 403
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/v0.6.0/start.js:9:19)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
code: 128
}
Error: Invalid status code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/v0.6.0/start.js:9:19)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

image-20230704152755728

查看报错信息发现 :

1
2
remote: Permission to cs7eric/cs7eric.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cs7eric/cs7eric.git/': The requested URL returned error: 403

是 actions 没有相应的权限去访问仓库,通过更改 Workflow 的访问权限后解决

在repository 中的 Settings -> Actions -> General -> Workflow Permissions 中修改权限为 Read and Write permissions

image-20230704153211887

image-20230704153246545

image-20230704154707677

相关信息也可以看一下 github的 issues : https://github.com/ad-m/github-push-action/issues/96

  • Title: github-actions[bot] 的 git 权限被拒绝
  • Author: cccs7
  • Created at: 2023-07-04 13:50:11
  • Updated at: 2023-07-04 19:16:20
  • Link: https://blog.cccs7.icu/2023/07/04/github-actions[bot]-的-git-权限被拒绝/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments
On this page
github-actions[bot] 的 git 权限被拒绝